import { actionTypes } from '../actions/counter';

const initState = {
    count: 12
};
// REDUCERS
export default (state = initState, action) => {
    switch (action.type) {
        case actionTypes.INCREMENT:
            return Object.assign({}, state, {
                count: state.count + 1
            });
        case actionTypes.DECREMENT:
            return Object.assign({}, state, {
                count: state.count - 1
            });
        case actionTypes.RESET:
            return Object.assign({}, state, {
                count: initState.count
            });
        default:
            return state;
    }
};
